﻿using System;
using System.Collections.Generic;
using UnityEngine;

namespace Z1029.NoteEditor
{
    public class ChartReader
    {
        public static Chart ReadChart(string file)
        {
            return JsonUtility.FromJson<Chart>(file);
        }
    }

    [Serializable]
    public class Chart
    {
        public string dataVersion;
        public float offset;
        public int numOfNotes;
        public JudgeLineSet judgeline;
    }

    [Serializable]
    public class ValueSet
    {
        public float startTime;
        public float endTime;
        public float start;
        public float end;
        public float start2;
        public float end2;
    }

    [Serializable]
    public struct SpeedEvent
    {
        public float startTime;
        public float endTime;
        public float value;
    }

    [Serializable]
    public class JudgeLineSet
    {
        public float bpm;
        public List<SpeedEvent> speedEvents;
        public List<Z1029.NoteGlobalView.ValueSet> moves;
        public List<Z1029.NoteGlobalView.ValueSet> rotates;
        public List<Z1029.NoteGlobalView.ValueSet> alphas;
        public List<NoteData> notesAbove;
        public List<NoteData> notesBelow;
    }

    [Serializable]
    public class NoteData
    {
        public NoteType type;
        public double time;
        public float positionX;
        public float speed;
        public int beatTime;
        public int beatHoldTime;
    }

    public class PhiEditorChartReader : ChartReader
    {

    }
}

